import { $get_, $delete } from '@js/request'
import { AuthoritySchema } from '@src/components/schema/authority'
import { RoleShcema } from '@src/components/schema/role'

// 获取角色列表
export async function getRoleListRequest (): Promise<RoleShcema[]> {
  const res = await $get_('/api/common/role')
  return res.data
}

// 删除角色
export async function delRequst (id: string): Promise<void> {
  const res = await $delete(`/api/common/role/${id}`)
  return res.data
}

// 获取全部权限项
export async function getRuleListRequest (): Promise<AuthoritySchema[]> {
  const res = await $get_('/api/common/rule/list', {
    condition: JSON.stringify([{ k: 'type', o: '=', v: 'desktop' }])
  })
  return res.data
}
